package liudan.archetype.annotationtest;

import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * Description:
 * Email: liudan@ucfgroup.com
 * Title
 * Copyright: Copyright (c) 2017
 * User: liudan
 * Created on 2017/3/3 22:51
 */
public class AnnTest {

    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {

        System.out.println("aa|class".split("|")[0]);
//        Class cla = AnnoTest.class;
//        Method method = cla.getMethod("doAnn", new Class[]{});
//        AnnoTest annoTest = new AnnoTest();
//        if (method.isAnnotationPresent(MyAnnotation.class)) {
//
//            //执行方法
//            method.invoke(annoTest, new Object[]{});
//            //获取annotation值
//            MyAnnotation myAnnotation = method.getAnnotation(MyAnnotation.class);
//            String hell = myAnnotation.hello();
//            System.out.println(hell);
//        }
//
//        //获取所有注解类名
//        Annotation[] annotations = method.getAnnotations();
//        for (Annotation anno:annotations){
//            System.out.println(anno.annotationType().getName());
//        }

    }
}
